package com.explorati.design_pattern.behavior.strategy.example;

public class ContextClient {

	private DiscountStrategy ds;

	public ContextClient(DiscountStrategy ds) {
		this.ds = ds;
	}

	public double contextCalDisc() {
		return ds.calculateDiscount();
	}

	public static void main(String[] args) {

		ContextClient context0 = new ContextClient(new NoDiscountStrategy(48.5, 20));
		System.out.println("0折扣：" + context0.contextCalDisc());

		ContextClient context1 = new ContextClient(new FixDiscountStrategy(46, 60));
		System.out.println("固定折扣：" + context1.contextCalDisc());
	}
}
